<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    // 原数组中的方法保存起来
    var arrayProto = Array.prototype
    // 创建一个对象，它的原型链指向到 arrayProto 对象上
    var arrayMethods = Object.create(arrayProto)
    // 保存了psuh方法
    var original = arrayProto['push'];

    arrayMethods.__proto__.push = function (...arg) {
      // 调用原方法
      original.call(this, ...arg)
      console.log('你好!')
    }

    let arr = [1, 2, 3]
    arr.push(6)
    console.log(arr)



  </script>


</body>

</html>